package SpringBoot.spring_boot_starter_websocket.D01_获取服务器时间;

import org.springframework.boot.Banner;
import org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration;
import org.springframework.boot.autoconfigure.web.DispatcherServletAutoConfiguration;
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpEncodingAutoConfiguration;
import org.springframework.boot.autoconfigure.web.HttpMessageConvertersAutoConfiguration;
import org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration;
import org.springframework.boot.autoconfigure.websocket.WebSocketMessagingAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;


@Configuration
@Import({
    // Tomcat，可以使用@RestController, 
    DispatcherServletAutoConfiguration.class,
    EmbeddedServletContainerAutoConfiguration.class,    // 注册容器类型
    ServerPropertiesAutoConfiguration.class,            // 用于初始化容器相关的配置属性，如服务地址、端口、contextPath，并根据当前容器类型初始化各个容器的特有属性，如tomcat的maxThreads、uriEncoding等等，其对应的属性类为ServerProperties；
    HttpEncodingAutoConfiguration.class,                // 注册http编码过滤器
    // SpringMvc，可以访问静态资源
    WebMvcAutoConfiguration.class,                    // *** 注册SpringMvc相关处理器，如ResourceResolver、RequestMappingHandlerAdapter、ExceptionHandlerExceptionResolver、ViewResolver、LocaleResolver，等等
    HttpMessageConvertersAutoConfiguration.class,     // *** 注册json或者xml处理器
    // WebSocket
    WebSocketAutoConfiguration.class,                 // *** 注册webSocket相关处理器，根据容器类型注册不同的处理器
    WebSocketMessagingAutoConfiguration.class,
    // XML
    JacksonAutoConfiguration.class,
})
@ComponentScan(value = { "SpringBoot.spring_boot_starter_websocket.D01_获取服务器时间" })
public class D01_获取服务器时间 {
	public static void main(String[] args) {
		new SpringApplicationBuilder()
			.bannerMode(Banner.Mode.OFF)
	        .sources(D01_获取服务器时间.class)
	        .run(new String[]{
	                "--debug=false"
	              , "--server.port=9999"
	        });
	}
}
